package com.fancy.learncenter.activity;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.widget.TextView;

import com.fancy.learncenter.activity.base.BaseActivity;
import com.fancy.learncenter.adapter.FragPagerAdapter;
import com.fancy.learncenter.fragment.MyHdApplyFragment;
import com.fancy.learncenter.fragment.MyTrainApplyFragment;
import com.superservice.lya.R;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

public class MyFancyMoveActivity extends BaseActivity {

    @Bind(R.id.title)
    TextView title;
    @Bind(R.id.tabs)
    TabLayout tabs;
    @Bind(R.id.viewPager)
    ViewPager viewPager;

    FragPagerAdapter mAdapter;
    List<Fragment> fragments = new ArrayList<>();
    List<String> titles = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.fragment_mycollect, getResources().getColor(R.color.toolbar_color));
        initToolbar("我的报名");
        ButterKnife.bind(this);
        initView();
    }

    private void initView() {

        titles.add("培训");

        titles.add("活动");

        fragments.add(new MyTrainApplyFragment());

        fragments.add(new MyHdApplyFragment());


        mAdapter = new FragPagerAdapter(getSupportFragmentManager(), fragments, titles);
        //设置 NestedScrollView 的内容是否拉伸填充整个视图，
        //这个设置是必须的，否者我们在里面设置的ViewPager会不可见
        viewPager.setAdapter(mAdapter);
        tabs.setupWithViewPager(viewPager);
    }
}
